package com.haulmont.asu.entity;

import com.haulmont.cuba.core.entity.BaseUuidEntity;
import com.haulmont.cuba.core.entity.annotation.OnDeleteInverse;
import com.haulmont.cuba.core.global.DeletePolicy;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Author: Sergey42
 * Date: 17.11.13 13:46
 */
@Table(name = "EXT_COMMAND_RELATION")
@Entity(name = "ext$CommandRelation")
public class CommandRelation extends BaseUuidEntity {

    private static final long serialVersionUID = 478265360178464724L;

    @ManyToOne
    @JoinColumn(name = "COMMAND_ID")
    @OnDeleteInverse(DeletePolicy.CASCADE)
    protected Command command;

    @ManyToOne
    @JoinColumn(name = "RELATED_COMMAND_ID")
    protected Command relatedCommand;

    public Command getCommand() {
        return command;
    }

    public void setCommand(Command command) {
        this.command = command;
    }

    public Command getRelatedCommand() {
        return relatedCommand;
    }

    public void setRelatedCommand(Command relatedCommand) {
        this.relatedCommand = relatedCommand;
    }
}
